<%@ page language="java" import="java.util.*,entity.*, dao.UserDao" pageEncoding="ISO-8859-1"%>
<%
String account = request.getParameter("account");
String password = request.getParameter("password");
if (account ==null || password == null||account.trim() ==""||password.trim() =="") {
	out.print("<script type='text/javascript'>alert('Please input User Name or Password');history.go(-1);</script>");
}
else
{
	UserDao dao = new UserDao();
	User user = dao.checkLogin(account, password);
	if (user == null)
	{
		out.print("<script type='text/javascript'>alert('Login failure, User Name/Password is wrong');history.go(-1);</script>");
	}
	else if (user.getIsValid() != 0)
	{
		out.print("<script type='text/javascript'>alert('This is illegal user');history.go(-1);</script>");
	}
	else
	{
		session.setAttribute("curUserInfo", user);
		response.sendRedirect("Default.jsp");
	}
}
%>